package com.dgut.hisystem.mapper;

import com.dgut.hisystem.entity.Advice;
import com.dgut.hisystem.entity.Drug;
import com.dgut.hisystem.entity.Prescription;
import com.dgut.hisystem.entity.VO.PrescriptionVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DrugMapper {
    List<Drug> getAll();

    @Select("{Select * from drug_info where yp_id like concat('%',#{id},'%')}")
    List<Drug> getDrug(long id);

    Drug getDrugById(long id);

    Drug getDrugByName(String name);

    void delete(long id);

    void updatePrice(Integer id, Double price);

    void updateAmount(Integer id, Integer amount);

    @Update({"UPDATE drug_info SET yp_amount = yp_amount - #{amount} WHERE yp_id = #{id}"})
    void subAmount(Long id, Integer amount);

    void insertDrug(Drug d);

    List<Prescription> selectAllPrescription();

    long SelectBrcardByBlid(long bl_id);

    long SelectYsidByBlid(long bl_id);

    long selectYhidByBrcard(long bl_card);

    String selectYsofficeByYsid(long ys_id);

    long selectYhidByYsid(long ys_id);

    String selectYhnameByYhid(long yh_id);

    Advice selectAdviceById(Integer id);


}
